from flask import Blueprint
from .views import( 
    ProductOneResource,
    ProductResource,
    ArticleResource,
    UploadFile,
    SwiperRource,
    DescReource,
    GoodnessResource,
    ProductExamplesResource,
    AliPayCallBack,
    OrderResource,
    OrderOneResource,
    GetLoginUuid,
    UseCard,
    CheckLogin,
    Send,
    OrderList,
    WangEditorUpload,
    TutorialsResource,
    ArticleOneResource,
    SendProcess,
    FrontLogin,
    RegisterCheck,
    Profile,
    MakeDistribution,
    transfer as Transfer
)
from flask_restful import Api
BP = Blueprint('front',__name__)

BP.add_url_rule('/upload/',view_func=UploadFile.as_view('upload'),methods=['POST'])
BP.add_url_rule('/uploads/<filename>',view_func=UploadFile.as_view('upload_get'),methods=['GET'])

BP_API = Api(BP)


BP_API.add_resource(SwiperRource,'/swiper/',endpoint='swipper')
BP_API.add_resource(DescReource,'/tips/',endpoint='tips')
BP_API.add_resource(GoodnessResource,'/goodness/',endpoint='goodness')
BP_API.add_resource(ProductExamplesResource,'/examples/',endpoint='examples')
BP_API.add_resource(ArticleResource,'/article/',endpoint='article')
BP_API.add_resource(ArticleOneResource,'/article/<int:id>/',endpoint='articleeone')
BP_API.add_resource(ProductResource,'/product/',endpoint='product')
BP_API.add_resource(ProductOneResource,'/product/<int:id>/',endpoint='productone')
BP_API.add_resource(AliPayCallBack,'/alipay/callback/',endpoint='alipaycallback')
BP_API.add_resource(OrderResource,'/by/now/',endpoint='bynow')
BP_API.add_resource(OrderOneResource,'/order/<int:id>/',endpoint='orderone')
BP_API.add_resource(GetLoginUuid,'/getlogin/',endpoint='getlogin')
BP_API.add_resource(UseCard,'/verify/',endpoint='verify')
BP_API.add_resource(CheckLogin,'/loginlisterner/',endpoint='loginlisterner')
BP_API.add_resource(Send,'/send/',endpoint='send')
BP_API.add_resource(WangEditorUpload,'/wangeditor/upload/',endpoint='wangeditor/upload')
BP_API.add_resource(OrderList,'/orders/',endpoint='orders')
BP_API.add_resource(TutorialsResource,'/tutorials/',endpoint='tutorials')
BP_API.add_resource(SendProcess,'/sendprocess/',endpoint='sendprocess')
BP_API.add_resource(FrontLogin,'/frontlogin/',endpoint='frontlogin')
BP_API.add_resource(RegisterCheck,'/register/check/',endpoint='registercheck')
BP_API.add_resource(Profile,'/profile/',endpoint='profile')
BP_API.add_resource(MakeDistribution,'/distribution/',endpoint='makemistribution')
BP_API.add_resource(Transfer,'/transfer/',endpoint='transfer')
# from werkzeug.routing import BaseConverter